package br.com.fatecpg.tp1.formularios;




/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * eletricidade.java
 *
 * Created on 20/10/2011, 13:22:27
 */

/**
 *
 * @author Fatec
 */
public class eletricidade extends javax.swing.JInternalFrame {

    /** Creates new form eletricidade */
    public eletricidade() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        megaTextField7 = new javax.swing.JTextField();
        abampereTextField9 = new javax.swing.JTextField();
        ampereTextField5 = new javax.swing.JTextField();
        coulombTextField10 = new javax.swing.JTextField();
        kiloTextField6 = new javax.swing.JTextField();
        microTextField3 = new javax.swing.JTextField();
        miliTextField4 = new javax.swing.JTextField();
        TipoampereComboBox1 = new javax.swing.JComboBox();
        nanoTextField2 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        conversãoTextField1 = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        gigaTextField8 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();

        setBackground(new java.awt.Color(0, 153, 51));
        setBorder(javax.swing.BorderFactory.createCompoundBorder());
        setClosable(true);
        setIconifiable(true);

        megaTextField7.setText("0");

        abampereTextField9.setText("0");

        ampereTextField5.setText("0");

        coulombTextField10.setText("0");

        kiloTextField6.setText("0");

        microTextField3.setText("0");

        miliTextField4.setText("0");

        TipoampereComboBox1.setFont(new java.awt.Font("Times New Roman", 0, 12));
        TipoampereComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nanoampére", "Microampére", "Miliampére", "Ampére", "Kiloampére", "Megaampére", "Gigaampére", "Abampére", "Coulomb por segundo", " " }));
        TipoampereComboBox1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                TipoampereComboBox1ItemStateChanged(evt);
            }
        });

        nanoTextField2.setText("0");

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel10.setText("Coulomb por segundo");

        conversãoTextField1.setText("0");

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel2.setText("Nanoampére");

        gigaTextField8.setText("0");

        jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel1.setText("Quero Converter:");

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel9.setText("Abampére");

        jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel6.setText("Kiloampére");

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel5.setText("Ampére");

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel4.setText("Miliampére");

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel3.setText("Microampére");

        jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel8.setText("Gigaampére");

        jLabel7.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel7.setText("Megaampére");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel3)
                        .addComponent(jLabel4)
                        .addComponent(jLabel5)
                        .addComponent(jLabel6)
                        .addComponent(jLabel7)
                        .addComponent(jLabel8)
                        .addComponent(jLabel9)
                        .addComponent(jLabel10)
                        .addComponent(conversãoTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE))
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(187, 187, 187)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(coulombTextField10)
                    .addComponent(abampereTextField9)
                    .addComponent(gigaTextField8)
                    .addComponent(megaTextField7)
                    .addComponent(kiloTextField6)
                    .addComponent(ampereTextField5)
                    .addComponent(miliTextField4)
                    .addComponent(microTextField3)
                    .addComponent(nanoTextField2)
                    .addComponent(TipoampereComboBox1, 0, 103, Short.MAX_VALUE))
                .addGap(60, 60, 60))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(conversãoTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TipoampereComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(nanoTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(microTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(miliTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(ampereTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(kiloTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(megaTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(gigaTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(abampereTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(coulombTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void TipoampereComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_TipoampereComboBox1ItemStateChanged
        if(TipoampereComboBox1.getSelectedItem().equals("Nanoampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            nanoTextField2.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*1;
            nanoTextField2.setText(res.toString());
            res=num*0.001;
            microTextField3.setText(res.toString());
            res=num*0.000001;
            miliTextField4.setText(res.toString());
            res=num*0.000000001;
            ampereTextField5.setText(res.toString());
            res=num*0.000000000001;
            kiloTextField6.setText(res.toString());
            res=num*0.000000000000001;
            megaTextField7.setText(res.toString());
            res=num*0.000000000000000001;
            gigaTextField8.setText(res.toString());
            res=num*0.0000000001;
            abampereTextField9.setText(res.toString());
            res=num*0.000000001;
            coulombTextField10.setText(res.toString());

        }else if(TipoampereComboBox1.getSelectedItem().equals("Microampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            microTextField3.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*1000;
            nanoTextField2.setText(res.toString());
            res=num*1;
            microTextField3.setText(res.toString());
            res=num*0.001;
            miliTextField4.setText(res.toString());
            res=num*0.000001;
            ampereTextField5.setText(res.toString());
            res=num*0.000000001;
            kiloTextField6.setText(res.toString());
            res=num*0.0000000000001;
            megaTextField7.setText(res.toString());
            res=num*0.000000000000001;
            gigaTextField8.setText(res.toString());
            res=num*0.0000001;
            abampereTextField9.setText(res.toString());
            res=num*0.000001;
            coulombTextField10.setText(res.toString());
        }else if(TipoampereComboBox1.getSelectedItem().equals("Miliampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            miliTextField4.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*1000000;
            nanoTextField2.setText(res.toString());
            res=num*1000;
            microTextField3.setText(res.toString());
            res=num*1;
            miliTextField4.setText(res.toString());
            res=num*0.001;
            ampereTextField5.setText(res.toString());
            res=num*0.000001;
            kiloTextField6.setText(res.toString());
            res=num*0.000000001;
            megaTextField7.setText(res.toString());
            res=num*0.000000000001;
            gigaTextField8.setText(res.toString());
            res=num*0.0001;
            abampereTextField9.setText(res.toString());
            res=num*0.001;
            coulombTextField10.setText(res.toString());
        }else if(TipoampereComboBox1.getSelectedItem().equals("Ampére")||
                TipoampereComboBox1.getSelectedItem().equals("Coulomb por segundo")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            ampereTextField5.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*1000000000;
            nanoTextField2.setText(res.toString());
            res=num*1000000;
            microTextField3.setText(res.toString());
            res=num*1000;
            miliTextField4.setText(res.toString());
            res=num*1;
            ampereTextField5.setText(res.toString());
            res=num*0.001;
            kiloTextField6.setText(res.toString());
            res=num*0.000001;
            megaTextField7.setText(res.toString());
            res=num*0.000000001;
            gigaTextField8.setText(res.toString());
            res=num*0.1;
            abampereTextField9.setText(res.toString());
            res=num*1;
            coulombTextField10.setText(res.toString());
        }else if(TipoampereComboBox1.getSelectedItem().equals("Kiloampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            kiloTextField6.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*(1000000000*1000);
            nanoTextField2.setText(res.toString());
            res=num*1000000000;
            microTextField3.setText(res.toString());
            res=num*1000000;
            miliTextField4.setText(res.toString());
            res=num*1000;
            ampereTextField5.setText(res.toString());
            res=num*1;
            kiloTextField6.setText(res.toString());
            res=num*0.001;
            megaTextField7.setText(res.toString());
            res=num*0.000001;
            gigaTextField8.setText(res.toString());
            res=num*100;
            abampereTextField9.setText(res.toString());
            res=num*1000;
            coulombTextField10.setText(res.toString());
        }else if(TipoampereComboBox1.getSelectedItem().equals("Megaampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            megaTextField7.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*(1000000000*1000000);
            nanoTextField2.setText(res.toString());
            res=num*(1000000000*1000);
            microTextField3.setText(res.toString());
            res=num*1000000000;
            miliTextField4.setText(res.toString());
            res=num*1000000;
            ampereTextField5.setText(res.toString());
            res=num*1000;
            kiloTextField6.setText(res.toString());
            res=num*1;
            megaTextField7.setText(res.toString());
            res=num*0.001;
            gigaTextField8.setText(res.toString());
            res=num*100000;
            abampereTextField9.setText(res.toString());
            res=num*1000000;
            coulombTextField10.setText(res.toString());
        }else if(TipoampereComboBox1.getSelectedItem().equals("Gigaampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            gigaTextField8.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num*(1000000000*1000000000);
            nanoTextField2.setText(res.toString());
            res=num*(1000000000*1000000);
            microTextField3.setText(res.toString());
            res=num*(1000000000*1000);
            miliTextField4.setText(res.toString());
            res=num*1000000000;
            ampereTextField5.setText(res.toString());
            res=num*1000000;
            kiloTextField6.setText(res.toString());
            res=num*1000;
            megaTextField7.setText(res.toString());
            res=num*1;
            gigaTextField8.setText(res.toString());
            res=num*100000000;
            abampereTextField9.setText(res.toString());
            res=num*1000000000;
            coulombTextField10.setText(res.toString());
        }else if(TipoampereComboBox1.getSelectedItem().equals("Abampére")){
            nanoTextField2.setText("");
            microTextField3.setText("");
            miliTextField4.setText("");
            ampereTextField5.setText("");
            kiloTextField6.setText("");
            megaTextField7.setText("");
            gigaTextField8.setText("");
            abampereTextField9.setText("");
            coulombTextField10.setText("");
            String s=conversãoTextField1.getText();
            gigaTextField8.setText(s);
            Double num =Double.parseDouble(conversãoTextField1.getText());

            Double res=num *(1000000000*10);
            nanoTextField2.setText(res.toString());
            res=num*10000000;
            microTextField3.setText(res.toString());
            res=num*10000;
            miliTextField4.setText(res.toString());
            res=num*10;
            ampereTextField5.setText(res.toString());
            res=num*0.01;
            kiloTextField6.setText(res.toString());
            res=num*0.00001;
            megaTextField7.setText(res.toString());
            res=num*0.00000001;
            gigaTextField8.setText(res.toString());
            res=num*1;
            abampereTextField9.setText(res.toString());
            res=num*10;
            coulombTextField10.setText(res.toString());
        }
}//GEN-LAST:event_TipoampereComboBox1ItemStateChanged
    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                 new eletricidade().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox TipoampereComboBox1;
    private javax.swing.JTextField abampereTextField9;
    private javax.swing.JTextField ampereTextField5;
    private javax.swing.JTextField conversãoTextField1;
    private javax.swing.JTextField coulombTextField10;
    private javax.swing.JTextField gigaTextField8;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField kiloTextField6;
    private javax.swing.JTextField megaTextField7;
    private javax.swing.JTextField microTextField3;
    private javax.swing.JTextField miliTextField4;
    private javax.swing.JTextField nanoTextField2;
    // End of variables declaration//GEN-END:variables

}
